var uv_SERVER;
if(!uv_SERVER){
	uv_SERVER='uv.terra.com.br';}

var ScrnSize=screen.width+"x"+screen.height;
var BrsrSize;
if(document.all){
	if(document.body){
		BrsrSize=document.body.clientWidth+"x"+document.body.clientHeight;}}
else{
	BrsrSize=(this.innerWidth-30)+"x"+(this.innerHeight-30);}
var ClientTime=new Date().toString();
var TimeZone=escape(ClientTime);

function uv_regPV(t){
	var u=window.location.protocol=='https:'?'https://':'http://';
	u+=uv_SERVER+'/UV'+'?c='+uv_c+'&ord='+Math.floor(Math.random()*1000000)+'&REF='+escape(document.referrer)+'&SCRNSZ='+ScrnSize+'&BRSRSZ='+BrsrSize+'&TIMEZONE='+TimeZone;
	if(t){
		document.write('<img src="'+u+'" width=1 height=1 border=0 style="position:absolute; width:0; height:0; z-index:1; top: 0; left: 0; visibility: hidden" alt="">');}
	else{
		var i=new Image();
		i.src=u;
		uv_IMGs[uv_IMGs.length]=i;}
}

uv_regPV(1);
var uv_IMGs=new Array();

function uv_addEvent(a,b,c){
	if(a.addEventListener){
		if(a.removeEventListener){
			try{
				a.removeEventListener(b,c,false);}
			catch(e){}}
		a.addEventListener(b,c,false);}
	else if(a.attachEvent){
		if(a.detachEvent){
			try{
				a.detachEvent("on"+b,c);}
			catch(e){}}
		a.attachEvent("on"+b,c);}
	else{
		with(a)
		eval("a.on"+b+"="+c)}
}

function uv_initForm(o,e,t){
	var F=eval("o.on"+e);
	if(String(F).indexOf('uv_regClick')!=-1)return;
	if(typeof eval("o.on"+e)!='function'){
		eval("o.on"+e+"=function(){uv_regClick(t);}")}
	else{
		eval("o.on"+e+"=function(){_FS = F();uv_regClick(t);return _FS;}")}
}

function uv_regClick(t){
	var u='http://null.uv.terra.com.br/UV'+'?c='+uv_c+'&ord='+Math.floor(Math.random()*1000000)+'&CLICK='+escape(t);
	var i=new Image();
	i.src=u;
	delay(500);
}

var isIE=(navigator.userAgent.indexOf("MSIE")!=-1);

var enableClick;

if(enableClick){
	var element;
	if(document.body){
		element=document.body;}
	else if(document){
		element=document;}
  uv_addEvent(element,'mousedown', whichClick);  
}

function whichClick(e){
	function L(str){
		return str.toLowerCase();
	}

	var a=null;
    try{
		a=document.all?window.event.srcElement:(e&&e.target?e.target:this);

		while(a&&a.nodeName&&!(L(a.nodeName)).match(/^(body|a|area|button|img|input)$/)){
			a=a.parentNode;}

		var t=z="";
		if(a){
			var nN=L(a.nodeName);

			if(nN.match(/^(a|area)$/)){
				t=a.href;}
			else if(nN=='img'){
				if(a.onclick){
					t=a.onclick;}
				else{
					while(a&&a.nodeName&&!(L(a.nodeName)).match(/^(body|a|area)$/)){
						a=a.parentNode;}
					if((L(a.nodeName)).match(/^(a|area)$/)){
						t=a.href;}}}
			else if(nN.match(/^(button|input)$/)){
				var f=a.form;
				t=f.action;

				uv_initForm(f,"submit",t,z);
				if(L(a.type)=="button"){
					if(a.onclick!='')uv_initForm(a,"click",t,z);}
				return;}

			if(t!=""){
				uv_regClick(t);}}}
	catch(e){}
}

function delay(gap){
	var then,now;
	then=new Date().getTime();
	now=then;
	while((now-then)<gap){
		now=new Date().getTime();}
}
